package haois.util;

import com.alibaba.fastjson.JSON;
import com.google.gson.Gson;

/**
 * Created by haol on 2017/4/23.
 */
public class GsonUtil {
    public static String toJson(Object o) {
        Gson gson = new Gson();
        JSON.toJSONString(o);
        return gson.toJson(o);
    }

    public static Object toObject(String text, Class c) {
        Gson gson = new Gson();
        return gson.fromJson(text, c);
    }
}
